<?php

if (!defined("EXPONENT")) exit("");

	$sermon= null;		
	if (isset($_GET['id'])) {
		$sermon= $db->selectObject('sermonmodule_sermon', 'id='.intval($_GET['id']));
		if ($sermon!= null) {
			$loc = unserialize($sermon->location_data);
		}
	}
	
	if ($sermon) {
		$loc = unserialize($sermon->location_data);
		if (exponent_permissions_check("delete",$loc)|| exponent_permissions_check("administrate",$loc)) {
			$db->delete('sermonmodule_sermon', 'id='.intval($_GET['id']));
			exponent_flow_redirect();
		} else {
			echo SITE_403_HTML;
		}
	} else {
		echo SITE_404_HTML;
	}

?>
